<script type="text/javascript">

for(var i=0;i<10;i++){
	console.log('for i', i);
	if(i > 5){
		break;
	}
}

const arr = Array.from(new Array(10).keys());
try{
	arr.forEach((i) => {
		console.log('foreach i', i);
		if(i > 5){
			throw new Error('break');
		}
	});
}catch(err){
	if(err.message !== 'break'){ throw err; }
}

</script>